#include <iostream>

using namespace std;

int main()
{
    int n;
    cin >> n;
    int count = 1, temp = n;

    while (temp--)
    {
        if (temp % 2 == 0)
        {
            for (int i = 0; i < n; ++i)
            {
                cout << count << " ";
                ++count;
            }
            cout << endl;
        }
        else
        {
            int f = n - 1;
            for (int i = 0; i < n; ++i)
            {
                cout << count + f << " ";
                --count;
            }
            cout << endl;
            count += 2 * n;
        }
    }

    return 0;
}